cmake_minimum_required(VERSION 3.14)

project(ip-route-metric-modifiler LANGUAGES CXX VERSION 0.0.6)

include(cmake/SparkWithGit.cmake)
spark_initialize_modules()

# 资源文件路径
set(QRC_SOURCES "src/resources/resources.qrc")

spark_add_executable_path(${PROJECT_NAME} 
    src
    src/widgets
    src/utils
    src/dialog
    ${QRC_SOURCES}
)
target_link_qt5(${PROJECT_NAME})

spark_framework_include_with_git(${PROJECT_NAME} 
    https://gitee.com/spark-framework-libs/spark-framework-features
    FEATURES qrcutil version screenutil)


# Debian 系列打包
if(EXISTS /etc/debian_version)
    set(LINUX_DEBIAN 1)
    if (CMAKE_VERSION VERSION_LESS 3.25)
        set(LINUX 1)
    endif()
endif(EXISTS /etc/debian_version)

if(LINUX AND LINUX_DEBIAN)
    spark_install_target(/usr/bin ${PROJECT_NAME})
    spark_install_file(/usr/share/${PROJECT_NAME}/ assets/icon.png)
    spark_desktop_macros(
        # 应用名称: Name=
        "IP Route Metric Modifier"
        # 应用名称: Name[zh_CN]=
        "IP Route Metric 修改器"
        # 应用说明: Comment=
        ""
        # 应用类型: Type=
        "Application"
        # 执行程序: Exec=
        "${PROJECT_NAME}"
        # 图标路径: Icon=
        "/usr/share/${PROJECT_NAME}/icon.png"
        # 应用分类: Categories=
        "Utility"
        # MIME类型: MimeType=
        ""
    )
    spark_install_file(/usr/share/applications ${SPARK_DESKTOP_FILE})

    add_package_descript(cmake/spark-deb-package.descript)
endif(LINUX AND LINUX_DEBIAN)
